namespace XEAS.Framework.ShellLib
{
    using System;

    public class ShellExecute
    {
        public const string EditFile = "edit";
        public const string ExploreFolder = "explore";
        public const string FindInFolder = "find";
        public const string OpenFile = "open";
        public IntPtr OwnerHandle = IntPtr.Zero;
        public string Parameters = "";
        public string Path = "";
        public const string PrintFile = "print";
        public ShowWindowCommands ShowMode = ShowWindowCommands.SW_NORMAL;
        public string Verb = "open";
        public string WorkingFolder = "";

        public bool Execute()
        {
            int num = (int) ShellApi.ShellExecute(this.OwnerHandle, this.Verb, this.Path, this.Parameters, this.WorkingFolder, (int) this.ShowMode);
            return (num > 0x20);
        }

        [Flags]
        public enum ShellExecuteFlags
        {
            SEE_MASK_ASYNCOK = 0x100000,
            SEE_MASK_CLASSKEY = 3,
            SEE_MASK_CLASSNAME = 1,
            SEE_MASK_CONNECTNETDRV = 0x80,
            SEE_MASK_DOENVSUBST = 0x200,
            SEE_MASK_FLAG_DDEWAIT = 0x100,
            SEE_MASK_FLAG_LOG_USAGE = 0x4000000,
            SEE_MASK_FLAG_NO_UI = 0x400,
            SEE_MASK_HMONITOR = 0x200000,
            SEE_MASK_HOTKEY = 0x20,
            SEE_MASK_ICON = 0x10,
            SEE_MASK_IDLIST = 4,
            SEE_MASK_INVOKEIDLIST = 12,
            SEE_MASK_NO_CONSOLE = 0x8000,
            SEE_MASK_NOCLOSEPROCESS = 0x40,
            SEE_MASK_NOQUERYCLASSSTORE = 0x1000000,
            SEE_MASK_UNICODE = 0x4000,
            SEE_MASK_WAITFORINPUTIDLE = 0x2000000
        }

        public enum ShellExecuteReturnCodes
        {
            ERROR_BAD_FORMAT = 11,
            ERROR_FILE_NOT_FOUND = 2,
            ERROR_OUT_OF_MEMORY = 0,
            ERROR_PATH_NOT_FOUND = 3,
            SE_ERR_ACCESSDENIED = 5,
            SE_ERR_ASSOCINCOMPLETE = 0x1b,
            SE_ERR_DDEBUSY = 30,
            SE_ERR_DDEFAIL = 0x1d,
            SE_ERR_DDETIMEOUT = 0x1c,
            SE_ERR_DLLNOTFOUND = 0x20,
            SE_ERR_FNF = 2,
            SE_ERR_NOASSOC = 0x1f,
            SE_ERR_OOM = 8,
            SE_ERR_PNF = 3,
            SE_ERR_SHARE = 0x1a
        }

        public enum ShowWindowCommands
        {
            SW_HIDE = 0,
            SW_MAXIMIZE = 3,
            SW_MINIMIZE = 6,
            SW_NORMAL = 1,
            SW_RESTORE = 9,
            SW_SHOW = 5,
            SW_SHOWDEFAULT = 10,
            SW_SHOWMAXIMIZED = 3,
            SW_SHOWMINIMIZED = 2,
            SW_SHOWMINNOACTIVE = 7,
            SW_SHOWNA = 8,
            SW_SHOWNOACTIVATE = 4,
            SW_SHOWNORMAL = 1
        }
    }
}

